package com.daylightrobbery.server.packet.game.player;

import com.daylightrobbery.server.GameManager;
import com.daylightrobbery.server.packet.PlayerInGame;
import com.daylightrobbery.server.packet.type.DataPacket;
import com.daylightrobbery.server.packet.type.RoomDataPacket;
import org.springframework.stereotype.Component;

import java.util.Dictionary;
import java.util.List;
import java.util.Map;

@Component
public class PlayerInfoSyncPacket implements RoomDataPacket {

    public int type = 80003;
    public String uid; // uid
    public int roomId; // roomId
    public CompressPlayerInfo player;
    public Map<String, List<CompressHouseInfo>> housesMap;
    public Map<String, List<Integer>> cards;
    public List<CompressTreasureBoxInfo> teaInfo;


    @Override
    public DataPacket process() {
        return this;
    }

    @Override
    public int getType() {
        return type;
    }

    public String getUid() {
        return uid;
    }

    public PlayerInfoSyncPacket setUid(String uid) {
        this.uid = uid;
        PlayerInGame inGame = GameManager.getInstance().getPlayerInGame(uid);
        inGame.setPacket(this);
        return this;
    }

    public int getRoomId() {
        return roomId;
    }

    public PlayerInfoSyncPacket setRoomId(int roomId) {
        this.roomId = roomId;
        return this;
    }

    public CompressPlayerInfo getPlayer() {
        return player;
    }

    public PlayerInfoSyncPacket setPlayer(CompressPlayerInfo player) {
        this.player = player;
        return this;
    }

    public Map<String, List<CompressHouseInfo>> getHousesMap() {
        return housesMap;
    }

    public PlayerInfoSyncPacket setHousesMap(Map<String, List<CompressHouseInfo>> housesMap) {
        this.housesMap = housesMap;
        return this;
    }

    public Map<String, List<Integer>> getCards() {
        return cards;
    }

    public PlayerInfoSyncPacket setCards(Map<String, List<Integer>> cards) {
        this.cards = cards;
        return this;
    }

    public List<CompressTreasureBoxInfo> getTeaInfo() {
        return teaInfo;
    }

    @Override
    public String toString() {
        return "PlayerInfoSyncPacket{" +
                "type=" + type +
                ", uid='" + uid + '\'' +
                ", roomId=" + roomId +
                ", player=" + player +
                ", housesMap=" + housesMap +
                ", cards=" + cards +
                ", teaInfo=" + teaInfo +
                '}';
    }

    public PlayerInfoSyncPacket setTeaInfo(List<CompressTreasureBoxInfo> teaInfo) {
        this.teaInfo = teaInfo;
        return this;
    }
}
